<template>
  <div>
    <a-form :form="form" style="max-width: 500px; margin: 40px auto 0;"  :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-item label="所学专业">
        <j-tree-select
          :disabled="isNotChangeInfo"
          placeholder=""
          dict="major,name,id"
          pidField="parentId"
          v-decorator="['professorMajor']">
        </j-tree-select>
      </a-form-item>

      <a-form-item label="毕业院校">
        <a-input v-decorator="['professorSchool']" :disabled="isNotChangeInfo"></a-input>
      </a-form-item>

      <a-form-item  label="毕业时间">
        <j-date v-decorator="['professorGraduateDate']" :disabled="isNotChangeInfo" :trigger-change="true" style="width: 100%"/>
      </a-form-item>

      <a-form-item label="申报类别">
        <j-category-select
          placeholder=""
          v-decorator="['professorDeclareCategory']"
          :disabled="isNotChangeInfo"
          pcode="B03"
          multiple
        />
      </a-form-item>
      <a-form-item label="从事专业">
        <a-input v-decorator="['professorWorkMajor']" :disabled="isNotChangeInfo"></a-input>
      </a-form-item>
      <a-form-item label="从事专业时间">
        <j-date v-decorator="['professorMajorDate']" :disabled="isNotChangeInfo" :trigger-change="true" style="width: 100%"/>
      </a-form-item>
      <a-form-item label="参加工作时间">
        <j-date  v-decorator="['professorBeginWork']" :disabled="isNotChangeInfo" :trigger-change="true" style="width: 100%"/>
      </a-form-item>
      <a-form-item label="工作单位">
        <a-input v-decorator="['professorWorkUnit']" :disabled="isNotChangeInfo"></a-input>
      </a-form-item>
      <a-form-item label="职务">
        <a-input v-decorator="['professorPosition']" :disabled="isNotChangeInfo"></a-input>
      </a-form-item>
      <a-form-item label="技术职称">
        <j-dict-select-tag type="list" v-decorator="['professorTitle']" :disabled="isNotChangeInfo" :trigger-change="true" dictCode="job_title"/>
      </a-form-item>


      <a-form-item label="本人支持或参加过的典型项目">
        <a-textarea  :rows="4" v-decorator="['professorProjectIntroduce']" :disabled="isNotChangeInfo"/>
      </a-form-item>
      <a-form-item label="业务主管部门">
        <a-textarea :rows="4" v-decorator="['professorLeadMsg']" :disabled="isNotChangeInfo"/>
      </a-form-item>
      <a-form-item label="行政审批局意见">
        <a-textarea :rows="4" v-decorator="['professorApproveMsg']" disabled/>
      </a-form-item>

      <a-form-item :wrapperCol="{span: 19, offset: 5}">
<!--        <div style="width: 100%">-->
<!--          <a-button  type="primary"  style="margin-left: 8px" @click="SaveTemp">点击保存</a-button>-->
<!--          <a-button  type="primary"  style="margin-left: 8px" @click="exportPDF"> 下载附件</a-button>-->
<!--        </div>-->
        <a-button type="primary" style="float: left" @click="prevStep">上一页</a-button>
        <a-button type="primary" style="float: right" @click="nextStep01">下一页</a-button>
      </a-form-item>
    </a-form>
  </div>
</template>

<script>
  import JDate from '@/components/jeecg/JDate'
  import JCategorySelect from '@/components/jeecg/JCategorySelect'
  import JTreeSelect from '@/components/jeecg/JTreeSelect'
  import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  import ATextarea from "ant-design-vue/es/input/TextArea";
  import {downloadFile} from '@/api/manage'
  // 导入
  import JImageUpload from '@/components/jeecg/JImageUpload'
  import ACol from "ant-design-vue/es/grid/Col";
  export default {
    name: "Step2",
    components:{
      ACol,
      ATextarea,
      JAreaLinkage,
      JTreeSelect,
      JImageUpload,
      JCategorySelect,
      JDate,
      JTreeSelect,
      downloadFile
    },
    props:{
      tes:{
        default:{},
        type: Object
      },
      isNotChangeInfo:{
        default:0,
        type: Boolean
      }
    },
    created(){
    },
    mounted(){
    this.form.setFieldsValue({
      professorSchool:this.tes.professorSchool,
        professorPhotoString:this.tes.professorPhotoString,
        professorMajor:this.tes.professorMajor,
        professorGraduateDate:this.tes.professorGraduateDate,
        professorWorkUnit:this.tes.professorWorkUnit,
        professorDeclareCategory:this.tes.professorDeclareCategory,
        professorPosition:this.tes.professorPosition,
        professorBeginWork:this.tes.professorBeginWork,
        professorTitle:this.tes.professorTitle,
        professorWorkMajor:this.tes.professorWorkMajor,
        professorMajorDate:this.tes.professorMajorDate,
        professorProjectIntroduce:this.tes.professorProjectIntroduce,
        professorLeadMsg:this.tes.professorLeadMsg,
        professorApproveMsg:this.tes.professorApproveMsg,
    });
    },
    data () {
      return {
        labelCol: { span: 4 },
        wrapperCol: { span: 14 },
        loading: false,
        form:this.$form.createForm(this),
        marjorId:"",
        schoolId:"",
        fieldvalue:{
          professorMajor:'',
          professorSchool:'',
          professorGraduateDate:'',
          professorDeclareCategory:'',
          professorWorkMajor:'',
          professorMajorDate:'',
          professorBeginWork:'',
          professorWorkUnit:'',
          professorPosition:'',
          professorTitle:'',
          professorProjectIntroduce:'',
          professorLeadMsg:'',
        },
      }
    },
    methods: {
      SaveTemp(){
        console.log("子组件保存");
        this.$emit('saveTemp');
      },
      exportPDF(){
        this.$emit('ExportPDF');
      },
      getfieldvalue(){
        const that = this;
        this.form.validateFields((err, values) => {
          // 获取表单中type的id
          this.fieldvalue.professorMajor = that.form.getFieldValue("professorMajor");
          this.fieldvalue.professorSchool = that.form.getFieldValue("professorSchool");
          this.fieldvalue.professorGraduateDate = that.form.getFieldValue("professorGraduateDate");
          this.fieldvalue.professorDeclareCategory = that.form.getFieldValue("professorDeclareCategory");
          this.fieldvalue.professorWorkMajor = that.form.getFieldValue("professorWorkMajor");
          this.fieldvalue.professorMajorDate = that.form.getFieldValue("professorMajorDate");
          this.fieldvalue.professorBeginWork = that.form.getFieldValue("professorBeginWork");
          this.fieldvalue.professorHomeAddress = that.form.getFieldValue("professorHomeAddress");
          this.fieldvalue.professorWorkUnit = that.form.getFieldValue("professorWorkUnit");
          this.fieldvalue.professorPosition = that.form.getFieldValue("professorPosition");
          this.fieldvalue.professorTitle = that.form.getFieldValue("professorTitle");
          this.fieldvalue.professorProjectIntroduce = that.form.getFieldValue("professorProjectIntroduce");
          this.fieldvalue.professorLeadMsg = that.form.getFieldValue("professorLeadMsg");
        })
      },
      nextStep01 () {
        this.getfieldvalue();
        this.$emit('nextStep');
        this.$emit('setfiled1',this.fieldvalue);
      },
      prevStep () {
        this.getfieldvalue();
        this.$emit('prevStep')
        this.$emit('setfiled1',this.fieldvalue);
      }
    }
  }
</script>

<style lang="less" scoped>
  .stepFormText {
    margin-bottom: 24px;

    .ant-form-item-label,
    .ant-form-item-control {
      line-height: 22px;
    }
  }

</style>